﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AssetHelper  {

    private static readonly string defaultBundleSuffix = ".nm";
    private static readonly string sceneFolderName = "Scene";

    public static string MakeBundleFullPath(string path)
    {
        string bundleFile;
        bundleFile = string.Format("{0}/{1}", ResourcePath.BundlePath, path);
        return bundleFile;
    }

    public static string MakeBundleName(string path)
    {
        return (path + defaultBundleSuffix).ToLower();
    }

    public static string MakeScenePath(string sceneName)
    {
        return sceneFolderName + "/" + sceneName + defaultBundleSuffix;
    }

    public static void ExtractGroupAndAssetName(string path, out string groupName, out string assetName)
    {
        groupName = string.Empty; assetName = string.Empty;
        BundleConfig.Instance().ContainsInFolder(path, out groupName);
        if (!groupName.Equals(string.Empty))
        {
            assetName = path.Replace(groupName, "");
            if (assetName.StartsWith("/"))
            {
                assetName = assetName.Remove(0, 1);
            }
        }
    }
}
